package com.qike.duola.controller;

import com.google.code.kaptcha.impl.DefaultKaptcha;
import com.qike.duola.domain.DuolaTransOrder;
import com.qike.duola.dto.*;
import com.qike.duola.response.BaseResult;
import com.qike.duola.response.RetResponse;
import com.qike.duola.service.DuolaCarService;
import com.qike.duola.service.DuolaTransOrderService;
import com.qike.duola.service.IsysResourceService;
import com.qike.duola.service.IsysUserService;
import com.qike.duola.utils.TokenUtil;
import com.qike.duola.vo.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@Api(description = "统计控制器")
@CrossOrigin
public class StatisticsController {


    private static Logger logger = LoggerFactory.getLogger(StatisticsController.class);

    @Autowired
    private TokenUtil tokenUtil;

    @Autowired
    private DefaultKaptcha captchaProducer;
    @Autowired
    private DuolaCarService duolaCarService;
    @Autowired
    private DuolaTransOrderService duolaTransOrderService;
    @Autowired
    private IsysUserService userService;
    @Autowired
    private IsysResourceService isysResourceService;

    @Autowired
    private RedisTemplate<String, Object> redisTemplate;


    /**
     * 运输方量统计
     *
     * @return
     */
    @GetMapping("/transVolumeCount")
    @ApiOperation("运输方量统计")
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code = 200, message = "ok", response = TransVolumeCountVo.class)
    })
    public BaseResult transVolumeCount(TransVolumeCountDto transVolumeCountDto) {
        try {
            TransVolumeCount vo = duolaTransOrderService.transVolumeCount(transVolumeCountDto);
            return RetResponse.makeOKRsp(vo);
        } catch (Exception e) {
            logger.error(e.getMessage());
            return RetResponse.makeErrRsp(e.getMessage());
        }
    }


//    /**
//     * 工程结算统计
//     *
//     * @return
//     */
//    @GetMapping("/projectTotalCount")
//    @ApiOperation("工程结算统计")
//    @ResponseBody
//    @ApiResponses({
//            @ApiResponse(code = 200, message = "ok", response = TransVolumeCountVo.class)
//    })
//    public BaseResult projectTotalCount(ProjectTotalCountDto projectTotalCountDto) {
//        try {
//            ProjectTotalCountVo vo = duolaTransOrderService.projectTotalCount(transVolumeCountDto);
//            return RetResponse.makeOKRsp(vo);
//        } catch (Exception e) {
//            logger.error(e.getMessage());
//            return RetResponse.makeErrRsp(e.getMessage());
//        }
//    }


}
